from django.db import models

# Create your models here.
from MarketApp.models import AxfGoods
from UserApp.models import AxfUser

# 订单表模型
class AxfOrder(models.Model):
    o_user = models.ForeignKey(AxfUser)
    # 总价
    o_price = models.FloatField(default=0)
    # 时间
    o_time = models.DateTimeField(auto_now_add=True)
    # 状态  判断是否已经发货, 默认为0，即没有发货
    o_status = models.IntegerField(default=0)

    class Meta:
        db_table = 'axf_order'

# 订单中的商品表模型
class OrderGoods(models.Model):
    o_order = models.ForeignKey(AxfOrder)
    # 购物车中选中的数据
    o_goods = models.ForeignKey(AxfGoods)
    # 订单数量
    o_goods_num = models.IntegerField(default=0)

    class Meta:
        db_table = 'axf_order_goods'
